<table class="ui celled striped table">
  <thead>
    <tr>
      <th>Topic</th>
      <th>Twitter</th>
      <th>Website</th>
      <th>Description</th>
      <th>News</th>
      <th>Episodes</th>
      <th>Posts</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
  <%= for topic <- @topics do %>
    <tr>
      <td>
        <img class="ui avatar image" style="border-radius: 0" src="<%= icon_url(topic) %>">
        <%= topic.name %> (<%= topic.slug %>)
      </td>
      <td><%= SharedHelpers.twitter_link(topic) %></td>
      <td><%= SharedHelpers.website_link(topic) %></td>
      <td><%= SharedHelpers.truncate(topic.description, 50) %></td>
      <td><%= news_count(topic) %></td>
      <td><%= episode_count(topic) %></td>
      <td><%= post_count(topic) %></td>
      <td class="center aligned">
        <div class="ui small basic buttons">
          <%= AdminHelpers.icon_link("eye", to: Routes.topic_path(@conn, :show, topic.slug)) %>
          <%= AdminHelpers.icon_link("edit", to: Routes.admin_topic_path(@conn, :edit, topic.slug)) %>
          <%= AdminHelpers.icon_link("trash", to: Routes.admin_topic_path(@conn, :delete, topic.slug), method: :delete, data: [confirm: "Are you sure?"]) %>
        </div>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>
